{{ $data := newScratch }}
{{ if eq .Page.Title "XMPP Clients" }}
    {{ $data.Set "data" .Site.Data.clients }}
{{ else if eq .Page.Title "XMPP Servers" }}
    {{ $data.Set "data" .Site.Data.servers }}
{{ else }}
    {{ $data.Set "data" .Site.Data.libraries }}
{{ end }}

{{ $cur_time := now.Format "2006-01-02" | time }}

<table>
    <thead>
        <tr>
            <th>Project Name</th>
            <th>Platforms</th>
        </tr>
    </thead>
    <tbody>
        {{ range $data.Get "data" }}
            {{ if .last_renewed }}
                {{ $last_renewal := dateFormat "2006-01-02" .last_renewed | time }}
                {{ $diff := $cur_time.Sub $last_renewal }}
                {{ if lt $diff.Hours 8760 }}
                    <tr>
                    {{ if .url }}
                    <td><a href="{{ .url }}">{{ .name }}</a></td>
                    {{ else }}
                    <td>{{ .name }}</td>
                    {{ end }}
                    <td>{{ delimit .platforms " / " }}</td>
                    </tr>
                {{ end }}
            {{ end }}
        {{ end }}
    </tbody>
</table>
